<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Article extends Model
{
    use SoftDeletes;
    //
    protected $casts = [
        'tag_id'    =>  'array',
    ];

/*    public function setTagIdAttribute($value){
        $this->attribute['tag_id'] = json_encode($value);
    }

    public function getTagIdAttribute($value){
        return json_decode($value,true);
    }*/

    public function getArticleList(){
        return $this->select('title')
            ->where('id','>',1)
            ->groupBy('title')
            ->get();
    }
}
